package cn.dengyongsheng.mybatis_test.mappers;

import cn.dengyongsheng.mybatis_test.entities.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    @Select("select * from dept;")
    List<Dept> getAllDept();

    @Select("select * from dept where deptid=#{deptId}")
    @Results(
            @Result(column = "deptid",property = "userList",
                    one = @One(select = "cn.dengyongsheng.mybatis_test.mappers.UserMapper.getUserListByDeptId"))
    )
    Dept getDeptById(Integer DeptId);
}
